﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace Model
{
    [DataContract]
    [MB.Orm.Mapping.Att.ModelMap("JDOrderMain", "JDOrderMain", new string[] { "ID" })]
    [KnownType(typeof(JDOrderMain))]
    public class JDOrderMain : MB.Orm.Common.BaseModel
    {
        public JDOrderMain()
        {

        }
        //订单号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderId", System.Data.DbType.Int64)]
        public long orderId { get; set; }
        //来源订单号(外系统来源订单号)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("srcOrderId", System.Data.DbType.String)]
        public string srcOrderId { get; set; }
        //来源平台id(0:未知;1:京东LSP;2:京东医药城;3:厂商直送;4:京东one 大多数;)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("srcPlatId", System.Data.DbType.Int64)]
        public long srcPlatId { get; set; }
        //来源订单类型(直接保持来源系统中的订单类型编号即可，具体码值，需要根据不同的srcSysId和srcType区分)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("srcOrderType", System.Data.DbType.Int16)]
        public int srcOrderType { get; set; }
        //内部订单来源类型(0:原订单，10:退款单，20:补货单，30:直赔商品 40:退货 50:上门换新)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("srcInnerType", System.Data.DbType.Int16)]
        public int srcInnerType { get; set; }
        //内部订单来源订单号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("srcInnerOrderId", System.Data.DbType.Int64)]
        public long srcInnerOrderId { get; set; }
        //10000:从门店出的订单;10010:众筹订单;20000:服务订单;30000:美食订单;40000:厂商直送类型;50000:一般自营类订单;60000	:开放仓类订单;90000 :临时美食订单（临时类型）;
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderType", System.Data.DbType.Int16)]
        public int orderType { get; set; }
        //订单库存归属(3:未维护;4:生鲜仓;5:冷藏仓;6:冷冻仓;7:1人团购)拆单拣货用(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderStockOwner", System.Data.DbType.Int16)]
        public int orderStockOwner { get; set; }
        //订单商品类型(0:其他;1:鲜食)(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderSkuType", System.Data.DbType.Int16)]
        public int orderSkuType { get; set; }
        //订单状态 实物类： 20010:锁定 20020:用户取消 20040:系统取消 31000:等待付款 31010:等待付款确认 32000:等待出库 32010:已出库 33030:站点收货 33040:配送中 33050:待自提 33060:已妥投 34000:京东已收款 34010:商家已收款 90000:完成 ；服务类： 20010:锁定 20020:用户取消 20040:系统取消 31000:等待付款 31020:已付款 32000：等待出库 34000:京东已收款 34010:商家已收款 41000:待处理 41010:已接单 51010:开始服务 51020:结束服务 90000:服务完成 ；美食类： 20010:锁定 20020:用户取消 20040:系统取消 41000:待接单 41010:已接单 33040:配送中 33060:已妥投
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderStatus", System.Data.DbType.Int16)]
        public int orderStatus { get; set; }
        //订单状态最新更改时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderStatusTime", System.Data.DbType.DateTime)]
        public DateTime orderStatusTime { get; set; }
        //下单时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderStartTime", System.Data.DbType.DateTime)]
        public DateTime orderStartTime { get; set; }
        //订单成交时间(货到付款类型订单的下单时间 or 在线支付类型订单的付款完成时间)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderPurchaseTime", System.Data.DbType.DateTime)]
        public DateTime orderPurchaseTime { get; set; }
        //订单时效类型(0:无时效;2:自定义时间;1:次日达;27:七小时达;24:六小时达;21:五小时达;18:四小时达;15:三小时达;12:两小时达;9:一小时达;6:半小时达;)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderAgingType", System.Data.DbType.Int16)]
        public int orderAgingType { get; set; }
        //订单预计送达时间(此字段暂不启用)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderPreDeliveryTime", System.Data.DbType.DateTime)]
        public DateTime orderPreDeliveryTime { get; set; }
        //预计送达开始时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderPreStartDeliveryTime", System.Data.DbType.DateTime)]
        public DateTime orderPreStartDeliveryTime { get; set; }
        //预计结束送达时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderPreEndDeliveryTime", System.Data.DbType.DateTime)]
        public DateTime orderPreEndDeliveryTime { get; set; }
        //订单取消时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderCancelTime", System.Data.DbType.DateTime)]
        public DateTime orderCancelTime { get; set; }
        //订单取消备注
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderCancelRemark", System.Data.DbType.String)]
        public string orderCancelRemark { get; set; }
        //订单删除时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderDeleteTime", System.Data.DbType.DateTime)]
        public DateTime orderDeleteTime { get; set; }
        //订单是否关闭
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderIsClosed", System.Data.DbType.Int16)]
        public int orderIsClosed { get; set; }
        //订单关闭时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderCloseTime", System.Data.DbType.DateTime)]
        public DateTime orderCloseTime { get; set; }
        //组织编号(商家在O2O平台的组织编号)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orgCode", System.Data.DbType.String)]
        public string orgCode { get; set; }
        //pop商家编号(京东商家管理平台中，商家唯一编号)(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("popVenderId", System.Data.DbType.String)]
        public string popVenderId { get; set; }
        //买家账号类型
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerPinType", System.Data.DbType.Int16)]
        public int buyerPinType { get; set; }
        //买家账号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerPin", System.Data.DbType.String)]
        public string buyerPin { get; set; }
        //买家昵称(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerNickName", System.Data.DbType.String)]
        public string buyerNickName { get; set; }
        //收货人名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerFullName", System.Data.DbType.String)]
        public string buyerFullName { get; set; }
        //收货人详细地址
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerFullAddress", System.Data.DbType.String)]
        public string buyerFullAddress { get; set; }
        //收货人电话
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerTelephone", System.Data.DbType.String)]
        public string buyerTelephone { get; set; }
        //收货人手机号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerMobile", System.Data.DbType.String)]
        public string buyerMobile { get; set; }
        //省Id(例:1:北京)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerProvince", System.Data.DbType.String)]
        public string buyerProvince { get; set; }
        //市Id(1:北京市;2:上海市;904:南京市;1381:武汉市;1601:广州市;1607:深圳市)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerCity", System.Data.DbType.String)]
        public string buyerCity { get; set; }
        //县Id(例:72:朝阳区)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerCountry", System.Data.DbType.String)]
        public string buyerCountry { get; set; }
        //镇Id(例:2799:朝外大街)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerTown", System.Data.DbType.String)]
        public string buyerTown { get; set; }
        //京东门店编号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("produceStationNo", System.Data.DbType.String)]
        public string produceStationNo { get; set; }
        //京东门店名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("produceStationName", System.Data.DbType.String)]
        public string produceStationName { get; set; }
        //商家门店编号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("produceStationNoIsv", System.Data.DbType.String)]
        public string produceStationNoIsv { get; set; }
        //配送门店编号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryStationNo", System.Data.DbType.String)]
        public string deliveryStationNo { get; set; }
        //配送门店名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryStationName", System.Data.DbType.String)]
        public string deliveryStationName { get; set; }
        //外部配送门店编号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryStationNoIsv", System.Data.DbType.String)]
        public string deliveryStationNoIsv { get; set; }
        //配送类型(1:京东配送 ;2:商家门店自送; 3:第三方配送 ;4:自提;)(此字段已停止维护)，以deliveryCarrierNo为准
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryType", System.Data.DbType.Int16)]
        public int deliveryType { get; set; }
        //承运商编号(9966:京东众包;2938:商家自送)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryCarrierNo", System.Data.DbType.String)]
        public string deliveryCarrierNo { get; set; }
        //承运商名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryCarrierName", System.Data.DbType.String)]
        public string deliveryCarrierName { get; set; }
        //承运单号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryBillNo", System.Data.DbType.String)]
        public string deliveryBillNo { get; set; }
        //包裹重量
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryPackageWeight", System.Data.DbType.Double)]
        public double deliveryPackageWeight { get; set; }
        //包裹体积(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryPackageVolume", System.Data.DbType.Double)]
        public double deliveryPackageVolume { get; set; }
        //配送员编号(此字段已停止维护，配送员信息请查根据订单号查询订单跟踪接口)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryManNo", System.Data.DbType.String)]
        public string deliveryManNo { get; set; }
        //配送员姓名(此字段已停止维护，配送员信息请查根据订单号查询订单跟踪接口)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryManName", System.Data.DbType.String)]
        public string deliveryManName { get; set; }
        //配送员电话(此字段已停止维护，配送员信息请查根据订单号查询订单跟踪接口)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryManPhone", System.Data.DbType.String)]
        public string deliveryManPhone { get; set; }
        //妥投时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("deliveryConfirmTime", System.Data.DbType.DateTime)]
        public DateTime deliveryConfirmTime { get; set; }
        //订单支付类型(1:货到付款;4:在线支付;)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderPayType", System.Data.DbType.Int16)]
        public int orderPayType { get; set; }
        //订单自提码(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderTakeSelfCode", System.Data.DbType.String)]
        public string orderTakeSelfCode { get; set; }
        //订单总金额
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderTotalMoney", System.Data.DbType.Int64)]
        public long orderTotalMoney { get; set; }
        //订单优惠总金额
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderDiscountMoney", System.Data.DbType.Int64)]
        public long orderDiscountMoney { get; set; }
        //订单运费总金额
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderFreightMoney", System.Data.DbType.Int64)]
        public long orderFreightMoney { get; set; }
        //订单货款总金额(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderGoodsMoney", System.Data.DbType.Int64)]
        public long orderGoodsMoney { get; set; }
        //用户应付金额=   订单总金额 - 订单优惠总金额 + 订单运费总金额 - 余额支付金额 + 包装金额
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderBuyerPayableMoney", System.Data.DbType.Int64)]
        public long orderBuyerPayableMoney { get; set; }
        //商家再收金额(如果是货到付款则和用户应付金额相同，如果是在线支付，则为0)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderVenderChargeMoney", System.Data.DbType.Int64)]
        public long orderVenderChargeMoney { get; set; }
        //包装金额
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("packagingMoney", System.Data.DbType.Int64)]
        public long packagingMoney { get; set; }
        //余额支付金额(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderBalanceUsed", System.Data.DbType.Int64)]
        public long orderBalanceUsed { get; set; }
        //订单开发票标识
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderInvoiceOpenMark", System.Data.DbType.Int16)]
        public int orderInvoiceOpenMark { get; set; }
        //订单结算财务机构号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderFinanceOrgCode", System.Data.DbType.Int16)]
        public int orderFinanceOrgCode { get; set; }
        //是否京东收款(0:否;1:是)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("isJDGetcash", System.Data.DbType.Int16)]
        public int isJDGetcash { get; set; }
        //是否存在调整单(0:否;1:是)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("adjustIsExists", System.Data.DbType.Int16)]
        public int adjustIsExists { get; set; }
        //调整次数记录
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("adjustCount", System.Data.DbType.Int16)]
        public int adjustCount { get; set; }
        //最新确认单id
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("adjustId", System.Data.DbType.Int64)]
        public long adjustId { get; set; }
        //京豆金额
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderJingdouMoney", System.Data.DbType.Int64)]
        public long orderJingdouMoney { get; set; }
        //服务技师姓名(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("serviceManName", System.Data.DbType.String)]
        public string serviceManName { get; set; }
        //服务技师电话(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("serviceManPhone", System.Data.DbType.String)]
        public string serviceManPhone { get; set; }
        //支付渠道
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("payChannel", System.Data.DbType.Int16)]
        public int payChannel { get; set; }
        //用户删除false：默认值，有效; true：无效，已删除
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("isDeleted", System.Data.DbType.Boolean)]
        public bool isDeleted { get; set; }
        //false：默认， 非拼团订单; true：是拼团订单
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("isGroupon", System.Data.DbType.Boolean)]
        public bool isGroupon { get; set; }
        //预计下发时间
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("preTransmissionTime", System.Data.DbType.DateTime)]
        public DateTime preTransmissionTime { get; set; }
        //下发标识
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("hasTransferred", System.Data.DbType.Boolean)]
        public bool hasTransferred { get; set; }
        //买家省名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerProvinceName", System.Data.DbType.String)]
        public string buyerProvinceName { get; set; }
        //买家市名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerCityName", System.Data.DbType.String)]
        public string buyerCityName { get; set; }
        //买家县名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerCountryName", System.Data.DbType.String)]
        public string buyerCountryName { get; set; }
        //买家镇名称
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerTownName", System.Data.DbType.String)]
        public string buyerTownName { get; set; }
        //买家ip
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerIp", System.Data.DbType.Int16)]
        public int buyerIp { get; set; }
        //收货人地址坐标类型(1:gps;2:sogou经纬度;3:baidu经纬度;4:mapbar经纬度;5:google经纬度（腾讯、高德坐标）;6:sogou墨卡托)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerCoordType", System.Data.DbType.Int16)]
        public int buyerCoordType { get; set; }
        //收货人地址坐标经度
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerLng", System.Data.DbType.Double)]
        public double buyerLng { get; set; }
        //收货人地址坐标纬度
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerLat", System.Data.DbType.Double)]
        public double buyerLat { get; set; }
        //发票类型
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderInvoiceType", System.Data.DbType.String)]
        public string orderInvoiceType { get; set; }
        //发票抬头
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderInvoiceTitle", System.Data.DbType.String)]
        public string orderInvoiceTitle { get; set; }
        //发票内容
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderInvoiceContent", System.Data.DbType.String)]
        public string orderInvoiceContent { get; set; }
        //订单买家备注
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderBuyerRemark", System.Data.DbType.String)]
        public string orderBuyerRemark { get; set; }
        //订单商家备注(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderVenderRemark", System.Data.DbType.String)]
        public string orderVenderRemark { get; set; }
        //订单配送备注(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderDeliveryRemark", System.Data.DbType.String)]
        public string orderDeliveryRemark { get; set; }
        //订单客服备注(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("orderCustomerServiceRemark", System.Data.DbType.String)]
        public string orderCustomerServiceRemark { get; set; }
        //业务标识，用英文分号分隔（订单打标写入此字段，如one.dingshida）
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("businessTag", System.Data.DbType.String)]
        public string businessTag { get; set; }
        //特殊服务标签(加热、切碎、要餐具、微辣、超辣。。。)(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("specialServiceTag", System.Data.DbType.String)]
        public string specialServiceTag { get; set; }
        //购物车id(此字段已停止维护)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("cartId", System.Data.DbType.String)]
        public string cartId { get; set; }
        //设备id
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("equipmentId", System.Data.DbType.String)]
        public string equipmentId { get; set; }
        //用户poi
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("buyerPoi", System.Data.DbType.String)]
        public string buyerPoi { get; set; }
        //行业标签id
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("businessTagId", System.Data.DbType.Int16)]
        public int businessTagId { get; set; }
        //订购人姓名(此字段针对鲜花业务)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("ordererName", System.Data.DbType.String)]
        public string ordererName { get; set; }
        //订购人电话(此字段针对鲜花业务)
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("ordererMobile", System.Data.DbType.String)]
        public string ordererMobile { get; set; }
        //app版本号
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("appVersion", System.Data.DbType.String)]
        public string appVersion { get; set; }
        //技师头像URL
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("artificerPortraitUrl", System.Data.DbType.String)]
        public string artificerPortraitUrl { get; set; }
        //拼团团Id
        [DataMember]
        [MB.Orm.Mapping.Att.ColumnMap("grouponId", System.Data.DbType.Int64)]
        public long grouponId { get; set; }

        public List<JDOrderProduct> OrderProduct { get; set; }

        public List<JDOrderDiscount> OrderDiscount { get; set; }

    }
}
